const fs = require("fs");
const path = require("path");

let filePath = path.join(__dirname, "to.txt");
let fileObj = fs.statSync(filePath);

function createTime(timer) {
    let obj = new Date(timer);
    let year = obj.getFullYear();
    let month = obj.getMonth() + 1;
    let date = obj.getDate();
    return year + "-" + month + "-" + date;
}
console.log(fileObj);
console.log("文件大小:" + fileObj.size);
console.log("文件创建时间:" + createTime(fileObj.birthtimeMs));

//atime accesstime访问时间
//mtime 修改时间
//ctime 变化时间
//birthtime 文件创建时间